using System;
using Godot;

namespace Box {
    public class ProcessNodeStatusActivate : ProcessNode {
        public bool IsYes = false;
        public string Status;
        public bool Power;

        public override (string,ProcessTreeNodePortType)[] GetPortsDefines() {
            return new (string, ProcessTreeNodePortType)[]{
                ("Input",ProcessTreeNodePortType.Input),
                ("Yes",ProcessTreeNodePortType.Output),
                ("No",ProcessTreeNodePortType.Output)
            };
        }

        public override void onInputHigh(string from_port) {
            if(!Power) {
                Power = true;
                if(Tree.HasStatus(Status)) {
                    Output("Yes",ProcessTreeNodePortStatus.High);
                } else {
                    Output("No",ProcessTreeNodePortStatus.High);
                }
            }
            
        }
        public override void onInputLow(string from_port){
            if(Power) {
                Power = false;
                Output("Yes",ProcessTreeNodePortStatus.Low);
                Output("No",ProcessTreeNodePortStatus.Low);
            }
        }
    }
}